package com.hanzidong.cms.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hanzidong.cms.dao.UserMapper;
import com.hanzidong.cms.entity.User;
import com.hanzidong.cms.service.UserService;

@Service
public class UserServiceImpl implements UserService {

	@Resource
	private UserMapper userMapper;

	
	@Override
	public PageInfo<User> listUsers(Integer pageNum, Integer pageSize, User user) {
		//设置分页参数
		PageHelper.startPage(pageNum, pageSize);
		
		//查询数据
		List<User> list = userMapper.listUsers(user);
		
		//返回数据
		return new PageInfo<User>(list);
	}


	@Override
	public boolean updateUser(User user) {
		return userMapper.updateUser(user);
	}


	@Override
	public boolean reg(User user) {
		return userMapper.reg(user);
	}


	@Override
	public User login(User user) {
		return userMapper.login(user);
	}


	@Override
	public Integer checkUsername(String username) {
		return userMapper.checkUsername(username) ;
	}
}
